struct TreeNode* Find(struct TreeNode* root, int o1, int o2)
{
    if (root == NULL)
    {
        return NULL;
    }
    if (root->val == o1 || root->val == o2)
    {
        return root;
    }
    struct TreeNode* q1 = Find(root->left, o1, o2);
    struct TreeNode* q2 = Find(root->right, o1, o2);
    if (q1 || q2)
    {
        if (q1 != NULL && q2 != NULL)
            return root;
        if (q1)
            return q1;
        if (q2)
            return q2;
    }
    return NULL;
}

int lowestCommonAncestor(struct TreeNode* root, int o1, int o2) {
    // write code here
    struct TreeNode* i = Find(root, o1, o2);
    return i->val;
}